var webpack = require('webpack')
var path = require('path');

module.exports = {

  entry: path.resolve(__dirname, 'src/main.js'),

  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/dist/'
  },
  // 配置webpack-dev-server 的对象，这样就不需要在webpack-dev-server命令后加这两个参数了
  devServer: {
    inline: true,
    hot: true
  },

  module: {
    loaders: [
      {
        test: /\.js$/,
        loader: 'babel?presets=es2015'
      },
      {
        test: /\.vue$/,
        loader: 'vue'
      },
      {
        test: /\.css$/,
        loader: 'style!css'
      }
    ]
  },
  babel: {
    presets: ['es2015']
  },

  resolve: {
    extensions: ['', '.js', '.vue']
  },
  plugins: [
    new webpack.ProvidePlugin({
      $: 'jquery'
    }),
    new webpack.HotModuleReplacementPlugin(),
    /* //代码压缩，会是重新编译变得非常慢，开发不用他
    new webpack.optimize.UglifyJsPlugin({
      mangle: {
        except: ['$super', '$', 'exports', 'require']
        //以上变量‘$super’, ‘$’, ‘exports’ or ‘require’，不会被混淆
      },
      compress: {
        warnings: false
      }
    })*/
  ]


}